require 'View.Base.BehaviourView'

BaseView = class("BaseView", BehaviourView);

--启动事件--
function BaseView:Awake(obj)
	BehaviourView.Awake(self, obj)
	self.events = {}
	self:InitPanel();
	self.param = {}  --VIEWM.showView时传递的参数
end

--初始化面板--
function BaseView:InitPanel()

end

function BaseView:OnShow()
	BehaviourView.OnShow(self)
end

--刷新面板--
function BaseView:OnRefresh()

end

function BaseView:RemoveListeners()
	self:CleanEvent()
end

function BaseView:OnBeginShow() end
function BaseView:OnBeginHide() end

function BaseView:OnBackBtn()
	VIEWM.hideView(self.viewName)
end

function BaseView:AddEvent(event,func)
	table.insert(self.events, {event, func})
    EVTM.add(event, func, self)
end
function BaseView:RemoveEvent(event)
	for _, e in pairs(self.events) do
		if e[1]==event then
			EVTM.remove(e[1], e[2], self)
			break
		end
    end
end
function BaseView:CleanEvent()
    for _, e in pairs(self.events) do
        EVTM.remove(e[1], e[2], self)
    end
    self.events = {}
end

function BaseView:AppearAnimation() return 0 end --return animation duration
function BaseView:DisappearAnimation() return 0 end --return animation duration
function BaseView:ReceiveBack() return not self.constantView end
function BaseView:OnBack() return true end